package com.yilin.platform.base_core.configuration;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class StaticConfig implements WebMvcConfigurer {

    @Value("${file-mapping-enterprise.save-path}")
    private String savePath;
    @Value("${file-mapping-enterprise.mapping-path}")
    private String mappingPath;


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/");
        //文件路径映射
        registry.addResourceHandler(mappingPath+"/**").addResourceLocations("file:" +savePath);
    }
}